<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<html>
<head>
    <title>ИС "Аттестация рабочих мест"</title>
    <link rel="stylesheet" type="text/css" href="/arm/resources/css/style.css">
</head>
<body>


<f:view>
    <a4j:form ajaxSubmit="true">

         <%@ include file="/pages/common/menu.jsp" %>

        <rich:dataTable
                id="orgTbl"
                cellpadding="0" cellspacing="0"
                width="700" border="0"
                value="#{dicOrganizationBean.tableManager.list}"
                var="row"
                onRowClick="selectRow( '#{row.id}' )"
                rowClasses="#{dicOrganizationBean.tableManager.rowClasses}"
                >

            <rich:column>
                <f:facet name="header">
                    <h:outputText value="Наименование" />
                </f:facet>
                <h:outputText value="#{row.name}"/>
            </rich:column>

        </rich:dataTable>

        <a4j:jsFunction name="selectRow" reRender="orgTbl, orgEdit, orgDelete" ignoreDupResponses="true">
            <a4j:actionparam name="rowIndex" assignTo="#{dicOrganizationBean.tableManager.selectedId}"/>
        </a4j:jsFunction>


        <a4j:commandButton action="#{dicOrganizationBean.create}" value="Создать"/>
        <a4j:commandButton id="orgEdit"
                           action="#{dicOrganizationBean.edit}"
                           value="Редактировать"
                           disabled="#{not dicOrganizationBean.tableManager.selected}"/>
        <a4j:commandButton id="orgDelete"
                           action="#{dicOrganizationBean.delete}"
                           value="Удалить"
                           reRender="orgTbl"
                           disabled="#{not dicOrganizationBean.tableManager.selected}"/>
        <a4j:commandButton action="main" value="Назад"/>
    </a4j:form>
</f:view>
</body>
</html>